
Page({

  /**
   * 页面的初始数据
   */
  data: {
    bkgImg:"",
    // 状态栏高度
    statusBarHeight: wx.getStorageSync('statusBarHeight') + 'px',
    // 导航栏高度
    navigationBarHeight: wx.getStorageSync('navigationBarHeight') + 'px',
    // 胶囊按钮高度
    menuButtonHeight: wx.getStorageSync('menuButtonHeight') + 'px',
    // 导航栏和状态栏高度
    navigationBarAndStatusBarHeight:
      wx.getStorageSync('statusBarHeight') +
      wx.getStorageSync('navigationBarHeight') +
      'px',
    today : {"count":"--"},
    beforList:[],
    nomore:false,
  },

  
  onLoad: function (options) {
    wx.showLoading({
      title: '加载中',
    })
    let app = getApp()
    this.setData({bkgImg:app.globalData.url + "/ysu.jpg"})

    wx.request({
      url: app.globalData.url + '/question/tendays',
      data:{
        openId:app.globalData.userInfo.openid,
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: result => {
        let recordList = result.data.data
        console.log(recordList)
        let today = JSON.parse(recordList[0])
        this.setData({today:today})
        let beforeList = []
        for(let i = 1; i < recordList.length; ++i){
          let obj = JSON.parse(recordList[i])
          if(obj.count != 0){
            beforeList.push(obj);
          }
        }
        if(beforeList.length == 0){
          this.setData({nomore:true})
        }else{
          this.setData({
            beforeList:beforeList,
          })
        }
        wx.hideLoading()



      }
    })

  },
  quit:function(){
    wx.switchTab({
      url: '/pages/mine/mine',
    })
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  }
})